package com.hhh.demo.sx.controller;


import com.hhh.demo.sx.mapper.RecordMapper;
import com.hhh.demo.sx.service.RecordService;
import com.hhh.demo.sx.util.ResultMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hhh
 * @since 2022-01-04
 */
@Controller
@RequestMapping("/record")
public class RecordController {
    @Autowired
    private RecordService recordService;

    @RequestMapping("/index")
    public String openPage() {
        return "record";
    }


    @RequestMapping("/list")
    @ResponseBody
    public Map<String,Object> list(@RequestParam("page") int p,
                                   @RequestParam("limit") int limit,
                                   @RequestParam(value = "condition", required = false) String condition){
        return recordService.findAll(p,limit,condition);
    }
}

